package com.seed.commons.dbutil;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class DBBean implements Serializable{

	private static final long serialVersionUID = 1L;
	
	private Map<String,Object> map = new HashMap<String, Object>() ;

	public Map<String, Object> getMap() {
		return map;
	}

	public void setMap(Map<String, Object> map) {
		this.map.clear() ;
		for (String key : map.keySet()) {
			this.map.put(key, (Serializable)map.get(key)) ;
		}
		this.map = map;
	}
	
	public void clearMap() {
		map.clear() ;
	}
	
	public void setbean(String field,Object value) {
		map.put(field, value) ;
	}

	@SuppressWarnings("unchecked")
	public <T> T getbean(String field) {
		return (T) map.get(field.toUpperCase()) ;
	}
	
	@Override
	public String toString() {
		return "DBBean [map=" + map + "]";
	}
	
	

}
